package day7.timer.impl;

import java.util.concurrent.TimeUnit;

public class Main {
    public static void main(String[] args) throws InterruptedException {
        MyTimerTask t1 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("5s 之后");
            }
        };

        MyTimerTask t2 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("4s 之后");
            }
        };

        MyTimerTask t3 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("3s 之后");
            }
        };

        MyTimerTask t4 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("2s 之后");
            }
        };

        MyTimerTask t5 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("1s 之后");
            }
        };;

        MyTimerTask t6 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("2.5s 之后");
            }
        };


        MyTimer myTimer = new MyTimer();
        myTimer.schedule(t1, 5000);

        TimeUnit.SECONDS.sleep(1);
        myTimer.schedule(t6, 1500);
    }
}
